/// <reference path="./BaseOral.ts" />
namespace wmedu {
    /** 四则运算：先加再除（加法带括号） */
    export class FourOper_AD_B extends BaseOral implements IOralCreater {
        create(opt: IOralOpt) {
            let paramArea = opt.paramArea;
            let ops: Enum_OralOp[] = [Enum_OralOp.Add, Enum_OralOp.Div];
            let brackets: number[] = [0, 1]
            let first = new FourOper_Div();
            let fres = first.create({ blankSide: opt.blankSide, blankStr: opt.blankStr, paramArea: opt.mdParamArea })
            // 得到结果值
            let value = fres.value;

            let tempValue = fres.nums[0];
            let p1 = MathUtil.randomInt(tempValue - 1, 1);
            let p2 = tempValue - p1;

            let nums: number[] = [p1,p2,fres.nums[1]];
            let str = BuildUtil.getOralStr(opt.blankSide, opt.blankStr, nums, ops, value, brackets);
            let res: IOralSide = { nums: nums, ops: ops, value: value, str }
            return res;
        }
    }
}